
#ifndef VIDEODISPLAYWIDGET_H
#define VIDEODISPLAYWIDGET_H

#include <QWidget>
#include <QGridLayout>
#include <QLabel>
#include <QMap>
#include <QSet>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QMimeData>
#include "videowidget.h"



class VideoDisplayWidget : public QWidget
{
    Q_OBJECT

public:
    explicit VideoDisplayWidget(QWidget *parent = nullptr);
    ~VideoDisplayWidget();

    // 设置通道数量（支持4/9/16等分屏）
    void setChannelCount(int count);

private:
    QGridLayout *gridLayout;
    QMap<int, VideoWidget*> videoWidgets;
    int currentChannelCount = 0;
    VideoWidget* findVideoWidgetAt(const QPoint& pos) const;


protected:
    void dragEnterEvent(QDragEnterEvent *event) override;
    void dropEvent(QDropEvent *event) override;

private slots:
    // 处理拖拽视频流
    void handleDragVideoStream(const QString& rtmpUrl);

    void clearAllWidget();

signals:
    // 拖拽视频流信号
    void dragVideoStream(const QString& rtmpUrl);

    // 视频窗口单击信号
    void videoWidgetClicked(const QString &videoUrl);

    void transferinfo(const QString &time, const QString &msg);

};

#endif // VIDEODISPLAYWIDGET_H


